package com.bjpowerrnode.functionalInterface.consumerInterface;

import java.util.function.Consumer;

public class Test1 {
    public static void main(String[] args) {
        String s1 = "abc_sxt.lsl";
        System.out.println(s1.substring(s1.indexOf("_")));
        User user = new User();
        user.setAge(20);
        user.setName("sxt");
        User user1 = Utils.consumerUser(userTemp -> {
            userTemp.setAge(30);
        });
        System.out.println(user1);
        User user3 = Utils.consumerUser(user, user2 -> user2.setAge(40));
        System.out.println(user3);
    }
}

class Utils{
    public static User consumerUser(Consumer<User> consumer){
        User user = new User("sxt1",25);
        consumer.accept(user);
        return user;
    }
    public static User consumerUser(User user, Consumer<User> consumer){
        consumer.accept(user);
        return user;
    }
}